VERSION 5.00
Begin VB.Form frmManage 
   Caption         =   "Manage incidences"
   ClientHeight    =   3285
   ClientLeft      =   2760
   ClientTop       =   1350
   ClientWidth     =   3930
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   Moveable        =   0   'False
   ScaleHeight     =   3285
   ScaleWidth      =   3930
   StartUpPosition =   1  'CenterOwner
   Begin VB.CommandButton cmdClose 
      Caption         =   "Close"
      Height          =   495
      Left            =   2400
      TabIndex        =   9
      Top             =   2640
      Width           =   1095
   End
   Begin VB.CommandButton cmdOK 
      Caption         =   "OK"
      Enabled         =   0   'False
      Height          =   495
      Left            =   240
      TabIndex        =   8
      Top             =   2640
      Width           =   1095
   End
   Begin VB.ComboBox comAssign 
      Enabled         =   0   'False
      Height          =   315
      Left            =   1800
      TabIndex        =   7
      Text            =   "Select a user"
      Top             =   2040
      Width           =   1695
   End
   Begin VB.ComboBox comPriority 
      Enabled         =   0   'False
      Height          =   315
      Left            =   1800
      TabIndex        =   5
      Text            =   "1"
      Top             =   1440
      Width           =   1695
   End
   Begin VB.ComboBox comSeverity 
      Enabled         =   0   'False
      Height          =   315
      Left            =   1800
      TabIndex        =   4
      Text            =   "Normal"
      Top             =   840
      Width           =   1695
   End
   Begin VB.ComboBox comIncidence 
      Height          =   315
      Left            =   1800
      TabIndex        =   1
      Text            =   "Select a incidence"
      Top             =   240
      Width           =   1695
   End
   Begin VB.Label lblAssign 
      AutoSize        =   -1  'True
      Caption         =   "Assign to"
      BeginProperty Font 
         Name            =   "Arial"
         Size            =   14.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   330
      Left            =   240
      TabIndex        =   6
      Top             =   2040
      Width           =   1185
   End
   Begin VB.Label Label2 
      AutoSize        =   -1  'True
      Caption         =   "Priority"
      BeginProperty Font 
         Name            =   "Arial"
         Size            =   14.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   330
      Left            =   240
      TabIndex        =   3
      Top             =   1440
      Width           =   870
   End
   Begin VB.Label lblSeverity 
      AutoSize        =   -1  'True
      Caption         =   "Severity"
      BeginProperty Font 
         Name            =   "Arial"
         Size            =   14.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   330
      Left            =   240
      TabIndex        =   2
      Top             =   840
      Width           =   1020
   End
   Begin VB.Label lblIncidence 
      AutoSize        =   -1  'True
      Caption         =   "Incidence"
      BeginProperty Font 
         Name            =   "Arial"
         Size            =   14.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   330
      Left            =   240
      TabIndex        =   0
      Top             =   240
      Width           =   1245
   End
End
Attribute VB_Name = "frmManage"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False

Private Sub cmdClose_Click()
    Me.Hide
End Sub


Private Sub cmdOK_Click()
    Dim connector As New ADODB.Connection
    Dim rs As New ADODB.Recordset
    connector.CursorLocation = adUseClient
    connector.ConnectionString = "DRIVER={MySQL ODBC 3.51 Driver};" _
    & "SERVER=127.0.0.1;" _
    & "DATABASE=incidences;" _
    & "UID=root;" _
    & "OPTION=" & 1 + 2 + 8 + 32 + 2048 + 16384
    connector.Open
    rs.ActiveConnection = connector
    rs.CursorType = adOpenDynamic
    rs.CursorLocation = adUseClient
    rs.LockType = adLockOptimistic
    rs.Open ("update incidences set Status='Assigned', severity='" & Me.comSeverity.Text & "', priority=" & Me.comPriority.Text & ", Technic='" & Me.comAssign.Text & "' where ID_Incidence=" & Me.comIncidence.Text)
    MsgBox ("Incidence assigned")
End Sub

Private Sub comAssign_Click()
    Me.cmdOK.Enabled = True
End Sub

Private Sub comIncidence_Click()
    Me.comAssign.Enabled = True
    Me.comSeverity.Enabled = True
    Me.comPriority.Enabled = True
    Dim connector As New ADODB.Connection
    Dim rs As New ADODB.Recordset
    connector.CursorLocation = adUseClient
    connector.ConnectionString = "DRIVER={MySQL ODBC 3.51 Driver};" _
    & "SERVER=127.0.0.1;" _
    & "DATABASE=incidences;" _
    & "UID=root;" _
    & "OPTION=" & 1 + 2 + 8 + 32 + 2048 + 16384
    connector.Open
    rs.ActiveConnection = connector
    rs.CursorType = adOpenDynamic
    rs.CursorLocation = adUseClient
    rs.LockType = adLockOptimistic
End Sub

Private Sub Form_Load()
    Dim connector As New ADODB.Connection
    Dim rs As New ADODB.Recordset
    Dim rs2 As New ADODB.Recordset
    connector.CursorLocation = adUseClient
    connector.ConnectionString = "DRIVER={MySQL ODBC 3.51 Driver};" _
    & "SERVER=127.0.0.1;" _
    & "DATABASE=incidences;" _
    & "UID=root;" _
    & "OPTION=" & 1 + 2 + 8 + 32 + 2048 + 16384
    connector.Open
    rs.ActiveConnection = connector
    rs.CursorType = adOpenDynamic
    rs.CursorLocation = adUseClient
    rs.LockType = adLockOptimistic
    rs2.ActiveConnection = connector
    rs2.CursorType = adOpenDynamic
    rs2.CursorLocation = adUseClient
    rs2.LockType = adLockOptimistic
    rs.Open ("select ID_Incidence from incidences where Coordinator='" & frmLogin.txtLogin.Text & "'")
    While Not rs.EOF
        Me.comIncidence.AddItem (rs.Fields(0).Value)
        rs.MoveNext
    Wend
    Me.comSeverity.AddItem "Normal"
    Me.comSeverity.AddItem "Critical"
    Me.comSeverity.AddItem "Blocker"
    Me.comPriority.AddItem 1
    Me.comPriority.AddItem 2
    Me.comPriority.AddItem 3
    rs2.Open ("select Login from users where Rol='1'")
    While Not rs2.EOF
        Me.comAssign.AddItem (rs2.Fields(0).Value)
        rs2.MoveNext
    Wend
End Sub
